<template>
  <el-dialog title="新增巡检任务" :visible.sync="dialogVisible" width="30%" class="popup" :before-close="handleClose">
    <el-form ref="ruleForm" :model="ruleForm" status-icon :rules="rules" label-width="110px" class="demo-ruleForm">
      <el-form-item label="任务名称" prop="pass">
        <el-input v-model="ruleForm.pass" type="password" autocomplete="off" />
      </el-form-item>
      <el-form-item label="计划开始时间" prop="checkPass">
        <el-time-select placeholder="起始时间" v-model="startTime" :picker-options="{
      start: '08:30',
      step: '00:15',
      end: '18:30'
    }">
        </el-time-select>
      </el-form-item>
      <el-form-item label="计划完成时间" prop="age">
        <el-time-select placeholder="结束时间" v-model="endTime" :picker-options="{
      start: '08:30',
      step: '00:15',
      end: '18:30',
      minTime: startTime
    }">
        </el-time-select>
      </el-form-item>
      <el-form-item label="关联资产">
        <el-input v-model="ruleForm.age" type="textarea" />
      </el-form-item>
      <el-form-item label="任务内容">
        <el-input v-model="ruleForm.age" type="textarea" />
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button size="small" @click="dialogVisible = false">取 消</el-button>
      <el-button type="primary" size="small" @click="dialogVisible = false">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  data () {
    return {
      dialogVisible: false,
      ruleForm: {
        pass: '',
        checkPass: '',
        age: ''
      },
      startTime: '',
      endTime: ''
    }
  },
  computed: {
    rules () {
      return {
        pass: [
          { required: true, message: '请输入活动名称', trigger: 'blur' }
        ],
        checkPass: [
          { required: true, message: '请输入活动名称', trigger: 'blur' }
        ],
        age: [
          { required: true, message: '请输入活动名称', trigger: 'blur' }
        ]
      }
    }

  },
  methods: {
    toggleAdd (flag) {
      this.dialogVisible = flag
    },
    handleClose (done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          done()
        })
        .catch(_ => { })
    }
  }
}
</script>

<style lang="scss" scoped>
.popup {
  ::v-deep .el-dialog {
    border-radius: 4px;
  }
  ::v-deep .el-dialog__header {
    border-bottom: 1px solid #cdd0db;
  }
  ::v-deep .el-dialog__body {
    padding: 30px;
  }
}
</style>
